﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AI_HRnPayrollBusiness;
using log4net;
using Abalone.Common.DataAccess;
using AI_HRnPayrollReminders;

public partial class TestResult : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //int  totalcount=0;
        //GridView1.DataSource = new MasterBusiness().GetMailBox(100);
        
        //Label1.Text = totalcount.ToString();
       // Logger.Info("TestResult Page is called");
    }

    #region Logger Instance
    private static readonly ILog Logger = LogManager.GetLogger(typeof(TestResult));
    #endregion

    protected  BaseDataAccess _dataAccess;
    protected string connectionString;
     const string ConnectionStringKeyIELS = "IELS";

    protected override void OnError(EventArgs e)
    {
        base.OnError(e);
        // Get last error from the server
        Exception exc = Server.GetLastError();
        if (exc is Exception)
        {
            Logger.Error("Error at Page Level-->TestResult", exc);
            //if (MustCallConcludeMS)
            //{
            //    new BMinuteSheetBL().UpdateMinuteSheetStatus(HearingId, Common.Enumerations.MinuteSheetStatus.E, string.Empty,
            //      string.Empty, false, string.Empty, DateTime.MinValue, exc.Message, true);
            //}
            // Server.ClearError();
            // Clear the error from the server
            // throw exc;
        }
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {

        try
        {
            connectionString = Utility.GetConnectionStringBasedOnConnectionName(ConnectionStringKeyIELS);
            _dataAccess = DataAccessFactory.GetDataAccessLayer(DataProviderType.Sql, connectionString);
            BaseDataAccess _dataAccessNew;
            _dataAccessNew = DataAccessFactory.GetDataAccessLayer(DataProviderType.Sql, connectionString);
            if (DropDownList1.SelectedValue == "0")
            {
                GridView1.DataSource = _dataAccessNew.ExecuteDataSet(TextBox1.Text);
                GridView1.DataBind();
            }
            else
            {
                GridView1.DataSource = _dataAccessNew.ExecuteQuery(TextBox1.Text);
                GridView1.DataBind();
            }
        }
        catch (Exception ex)
        {
            Logger.Error(ex);
        }
    }
}